
import { getGroupList } from '@/api/index'
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'


export default function useOptions() {
    const options = ref([])
    
    onMounted(()=>{
        getGroupList().then(resp => {
            for (var i=0; i<(resp.data).length; i++){
                options.value.push( {label: resp.data[i]['name'], value: resp.data[i]['desc']} )
            }
        })
    })
    onBeforeUnmount(()=>{
        options.value = []
    })
    
    return {
        options
    }


}
